from multiprocessing import Process
import os,time


def work():
    res = 0
    for i in range(100000000):
        res *=i

if __name__ == "__main__":
    l = []
    print("本机为",os.cpu_count(),"核 CPU")
    start = time.time()
    for i in range(4):
        p = Process(target=work)
        l.append(p)
        p.start()
    for p in l:
        p.join()
    stop = time.time()
    print("计算密集型任务，多进程耗时 %s"%(stop-start))
